varying vec3 eyeNormal;
varying vec3 eyePosition;

void main (void)
{
	
    vec3 baseMapColor = vec3(1,0,0);
    
    vec3 normal = normalize(eyeNormal); 
    vec3 light = normalize( vec3(320,200,240));
    vec3 eye = normalize( eyePosition);
    vec3 r = reflect( eye, normal);
    const vec3 red = vec3( 0.5, 0.5, 0.5);
    const vec3 white = vec3( 1, 1, 1);

    // Compute a simple phong illumination with a directional light
    float ndotl = dot( normal, light);    
    ndotl = min( max( ndotl, 0.0) + 0.2, 1.0);
    float spec = pow( max( 0.0, dot( r, light)), 32.0);
    
    vec3 color = 2.0*clamp( ndotl*red + spec*white, 0.0, 1.0); 

    // Output the fragment color   
    gl_FragColor = vec4( baseMapColor*color, 1.0);
}